#!/bin/bash

echo "Building $(git log -1)"
echo "---"

set -Eeuxo pipefail

./tools/make_requests
./tools/make_specfiles
./tools/make_makefiles
autoreconf -f

cd build64
../configure -q -C --enable-win64 --enable-werror --with-mingw
make -s
cd ..

cd build32
../configure -q -C --enable-werror --with-mingw
make -s
cd ..

if ! test -s .git/rebase-merge/git-rebase-todo
then
    make -s -C build32 install-lib install-test DESTDIR=$BASEDIR
    make -s -C build64 install-lib install-test DESTDIR=$BASEDIR
fi

git reset --hard
